package com.link510.aitools.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.link510.aitools.R;
import com.link510.aitools.framework.activity.BaseAcitivity;
import com.link510.aitools.framework.view.audio.widget.RecordVoicePopWindow;

import butterknife.BindView;
import butterknife.OnClick;
import omrecorder.Recorder;


public class TestActivity extends BaseAcitivity {

    private String filePath = "";

    @BindView(R.id.rootLayout)
    LinearLayout mRoot;

    @BindView(R.id.mTestButton)
    Button mTestButton;

    RecordVoicePopWindow popupWindow;


    private Recorder recorder;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test);

        TextView textView = new TextView(TestActivity.this);
        textView.setText("测试文本");
        popupWindow = new RecordVoicePopWindow(mContext);
        popupWindow.setOutsideTouchable(true);//设置点击外部区域可以取消popupWindow

    }

    @OnClick(R.id.mTestButton)
    public void startButttonClick() {
        popupWindow.showAsDropDown(mTestButton);//设置popupWindow显示,并且告诉它显示在那个View下面
    }

//    @OnClick(R.id.stopButtton)
//    public void stopButttonClick() {
//
//        try {
//            recorder.stopRecording();
//            Logger.e("filePath1:" + filePath);
//        } catch (IOException e) {
//            Logger.e("filePath2:" + filePath);
//            e.printStackTrace();
//        }
//    }
//
//
//    private PullableSource mic() {
//        return new PullableSource.Default(
//                new AudioRecordConfig.Default(
//                        MediaRecorder.AudioSource.MIC, AudioFormat.ENCODING_PCM_16BIT,
//                        AudioFormat.CHANNEL_IN_MONO, 44100
//                )
//        );
//    }
//
//    private File file() {
//        return new File(filePath);
//    }


}